<?php

namespace app\send\controller;
use cmf\controller\HomeBaseController;
use app\send\logic\email\EmailLogic;
use app\send\logic\msg\MsgLogic;
/*
    发送短信-邮箱
*/
class SendController extends HomeBaseController
{   
    /**
     * 发送短信验证码
     * @param [type]  $param.phone [手机号]
     * @param [type]  $param.captcha [图像验证码 选填]
     * @param [type]  $param.type [短信服务商类型 选填 1阿里云 2云片 3聚合数据短信 4短信宝]
     */
    public function sendMsg(MsgLogic $lMsg){
        $param = $this->request->param();
        //dump($param);
        $rs = $lMsg->index($param);
        if($rs['code']){
            $this->success('发送成功','');
        }else{
            $this->error('发送失败','',$rs['msg']);
        }
    }
    /**
     * 发送邮箱验证码
     * @param  [type] email [邮箱验证码]
     */
    public function sendEmail(EmailLogic $lEmail){
        $param = $this->request->param();
        $rs = $lEmail->index($param);
        if($rs['code']){
            $this->success("发送邮件成功！",'',$rs['msg']);
        }else{
            $this->error("发送邮件失败！",'',$rs['msg']);
        }
    }

}